package cn.wmw.xyy.service.impl;

import cn.wmw.xyy.domain.CourseUserLearn;
import cn.wmw.xyy.mapper.CourseUserLearnMapper;
import cn.wmw.xyy.service.ICourseUserLearnService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wmw
 * @since 2022-12-31
 */
@Service
public class CourseUserLearnServiceImpl extends ServiceImpl<CourseUserLearnMapper, CourseUserLearn> implements ICourseUserLearnService {


    @Override
    public CourseUserLearn getByCourseId(Long courseId, Long loginId) {
        Wrapper<CourseUserLearn> wrapper = new EntityWrapper<>();
        wrapper.eq("course_id",courseId);
        wrapper.eq("login_id",loginId);
        return selectOne(wrapper);
    }

    @Override
    public List<CourseUserLearn> selectByLoginId(Long loginId) {
        Wrapper<CourseUserLearn> wrapper = new EntityWrapper<>();
        wrapper.eq("login_id", loginId);
        return selectList(wrapper);
    }
}
